package org.example.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.common.CommonResult;
import org.example.exception.ServiceException;
import org.example.feign.ProviderFeign;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author WN
 * @date：2024/03/25 13:53
 */
@RestController
@RequiredArgsConstructor
@Slf4j
public class ConsumerController {

    private final ProviderFeign providerFeign;

    @GetMapping("/consumer")
    public CommonResult<String> consumer(){
        CommonResult<String> result = providerFeign.provider();
        try {
            result.getCheckErrorData();
        } catch (ServiceException e) {
            log.error("远程调用异常：{}", (Object) e.getStackTrace());
        }
        return result;
    }
}
